package jaxb.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import parsetree.OperatorSpec;

public class SpecCollectionToArrayAdapter extends
XmlAdapter<OperatorSpec[], Collection<OperatorSpec>> {
    
    @Override
    public Collection<OperatorSpec> unmarshal(OperatorSpec[] v) throws Exception
    {
        return new ArrayList<OperatorSpec>(Arrays.asList(v));
    }
    
    @Override
    public OperatorSpec[] marshal(Collection<OperatorSpec> v) throws Exception
    {
        return v.toArray(new OperatorSpec[v.size()]);
    }
    
    
}
